package leetcode.code003.LongestSubstringWithoutRepeatingCharacters;

import leetcode.helper.HelpDebug;

public abstract class LongestSubstringWithoutRepeatingCharacters
		implements ILongestSubstringWithoutRepeatingCharacters {

	@Override
	public void debug1() {
//输入: s = "abcabcbb"
//输出: 3
//解释: 因为无重复字符的最长子串是 "abc"，所以其长度为 3。
		String s = "abcabcbb";
		int expect = 3;
		HelpDebug.printInputs(String.valueOf(expect), s);
		this.debug(s);
	}

	@Override
	public void debug2() {
//输入: s = "bbbbb"
//输出: 1
//解释: 因为无重复字符的最长子串是 "b"，所以其长度为 1。
		String s = "bbbbb";
		int expect = 1;
		HelpDebug.printInputs(String.valueOf(expect), s);
		this.debug(s);
	}

	@Override
	public void debug3() {
//输入: s = "pwwkew"
//输出: 3
//解释: 因为无重复字符的最长子串是 "wke"，所以其长度为 3。
//     请注意，你的答案必须是 子串 的长度，"pwke" 是一个子序列，不是子串。
		String s = "pwwkew";
		int expect = 3;
		HelpDebug.printInputs(String.valueOf(expect), s);
		this.debug(s);
	}

	@Override
	public void debug4() {
//输入: s = ""
//输出: 0
		String s = "";
		int expect = 0;
		HelpDebug.printInputs(String.valueOf(expect), s);
		this.debug(s);
	}


	public void debug5() {
		// 输入: s = ""
		// 输出: 0
		String s = "au";
		int expect = 2;
		HelpDebug.printInputs(String.valueOf(expect), s);
		this.debug(s);
	}

	@Override
	abstract public int lengthOfLongestSubstring(String s);

	@Override
	public void debug(String s) {
		int in = this.lengthOfLongestSubstring(s);
		System.out.println(in);
	}

}
